<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<title>Second Home Inc. :: Manage Reservations</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<%@ include file="manage-includes.jsp" %>
</head>
<body>
<div id="page-wrap" align="center">
    <%@ include file="../navigation.jsp" %>
    
	<table id="reservations">
		<thead>
			<tr>
				<th>Property</th>
				<th>Room</th>
				<th>Start Date</th>
				<th>Days</th>
				<th>People</th>
				<th>Total Cost</th>
				<c:if test="${user.admin}">
					<th>User E-mail</th>
				</c:if>
				<th>Options</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${reservations}" var="reserve">
				<tr>
					<td><c:out value="${reserve.hotelName}" /></td>
					<td><c:out value="${reserve.roomNumber}" /></td>
					<td><c:out value="${reserve.startDate}" /></td>
					<td><c:out value="${reserve.numOfDays}" /></td>
					<td><c:out value="${reserve.numOfPeople}" /></td>
					<td>$<c:out value="${reserve.totalCost}" /></td>
					<c:if test="${user.admin}">
						<td><c:out value="${reserve.email}" /></td>
					</c:if>
					<td>
						<c:if test="${reserve.startDate.time > today.time}">
							<form action="controller" method="post" class="inline">
								<input type="hidden" name="source" value="editRes" />
								<input type="hidden" name="id" value="<c:out value="${reserve.reservationId}" />" />
								<button type="submit" class="editReservation" title="Edit Reservation">Edit</button>
							</form>
							<form action="controller" method="post" class="inline">
								<input type="hidden" name="source" value="deleteRes" />
								<input type="hidden" name="id" value="<c:out value="${reserve.reservationId}" />" />
								<button type="submit" class="deleteReservation" title="Delete Reservation">Delete</button>
							</form>
						</c:if>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<!-- Include Delete Form -->
	<%@ include file="forms/deleteReservation.jsp" %>
</div>
</body>
</html>